import axios from 'axios'
import { Message, MessageBox } from 'element-ui'
import store from '../store'
import { getToken } from '@/utils/auth'
import {config} from "@vue/test-utils";

// 创建axios实例
const service = axios.create({
  // baseURL:process.env.VUE_APP_BASE_API,
  baseURL: "http://localhost:8001", // api 的 base_url
  timeout: 10000000 // 请求超时时间
})
// request拦截器
service.interceptors.request.use(
  config => {
    config.headers['Content-Type'] = "application/json;charset=utf-8";
    config.headers['Authorization'] = "eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NTc0NTU2NDcsInVzZXJJZCI6Im9PTjVBNmNoY1JGUDNmdVNVeHo3VjBlWWdZYTgiLCJpYXQiOjE2NTU1MjczODZ9.mInlgCZShjYngOJB9sRHywtQjFEKLmHiWs7RzAz2vxs"
    return config
  },
  error => {
    // Do something with request error
    console.log(error); // for debug
    Promise.reject(error)
  }
);

export default service
